package example.juc3;

import java.util.concurrent.TimeUnit;

public class TestDaemon {

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            System.out.println(Thread.currentThread().getName());
            System.out.println(Thread.currentThread().isDaemon());
            while (true) {

            }
        }, "t1");

        t1.setDaemon(true);
        t1.start();

        TimeUnit.SECONDS.sleep(3);

        System.out.println(Thread.currentThread().getName());

    }


}
